﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Hotnet.Entity;
using Hotnet.Dal.NSDalVideo;
using Hotnet.Entity.Enum;
using Hotnet.Entity.Search;

namespace Hotnet.Biz.NSBizVideo
{
	public class BizVideoList : BaseBiz<VideoList>
	{
		private static DalVideoList db = new DalVideoList();
		public BizVideoList() : base(db) { }

		public VideoList[] List(int id)
		{
			return db.ListBy(x=>x.VideoID==id);
		}

		public void Delete(int id, EnumVideoListType listType)
		{
			db.DeleteBy(x=>x.VideoID==id&&x.ListType==(int)listType);
		}

		public ViewVideoList[] List(SearchVideoList condition, int pageNo, int pageSize, out int totalCount)
		{
			return db.List(condition, pageNo, pageSize, out totalCount);
		}

		/// <summary>
		/// 列出视频各列表
		/// </summary>
		/// <param name="listType"></param>
		/// <param name="count"></param>
		/// <returns></returns>
		public ViewVideoList[] List(EnumVideoListType listType, int count)
		{
			int totalCount = 0;
			SearchVideoList condition = new SearchVideoList() { IsPublished = EnumPublishState.发布, OrderType = EnumOrder.添加时间, ListType = listType };
			return List(condition, 0, count, out totalCount);
		}

		/// <summary>
		/// 列出视频各列表（分类）
		/// </summary>
		/// <param name="listType"></param>
		/// <param name="count"></param>
		/// <returns></returns>
		public ViewVideoList[] List(EnumVideoListType listType, int categoryID, int count)
		{
			int totalCount = 0;
			SearchVideoList condition = new SearchVideoList() { IsPublished = EnumPublishState.发布, OrderType = EnumOrder.添加时间, ListType = listType, VideoCategroyId = categoryID };
			return List(condition, 0, count, out totalCount);
		}
	}
}
